﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using QLChiTieu.BLL;
using Company.Product.Entity;

namespace QLChiTieu
{
    public partial class XemChiTieu : Form
    {
        DataGridView grdThucTeChiTieu;
        DataGridView grdKeHoachChiTieu;
        public XemChiTieu()
        {
            InitializeComponent();
        }

        private void XemChiTieu_Load(object sender, EventArgs e)
        {
            DateTime date = DateTime.Now;
            Dictionary<string, DateTime> cbbItems = new Dictionary<string, DateTime>();
            cbbItems.Add(date.ToShortDateString(), date);
            for (int i = 0; i < 11; i++)
            {
                cbbItems.Add(date.AddMonths(1).ToShortDateString(), date);
            }
            cbbThoiGian.DataSource = cbbItems;
            cbbThoiGian.DisplayMember = "value";
            cbbThoiGian.ValueMember = "key";
            //http://stackoverflow.com/questions/3063320/combobox-adding-text-and-value-to-an-item-no-binding-source

            grdKeHoachChiTieu = new DataGridView();
            grdThucTeChiTieu = new DataGridView();

            ChiTieu_Provider provider = new ChiTieu_Provider();
            KeHoachChiTieuList listKeHoach = provider.GetKeHoachChiTieuListByDuration(DateTime.Now, DateTime.Now);

            grdKeHoachChiTieu.DataSource = listKeHoach;
            tabPage2.Controls.Add(grdKeHoachChiTieu);
        }
    }
}
